import { http, HttpResponse } from 'msw'
import Mock from 'mockjs'
// 查看操作记录
export const fileLogList = http.post('/data/ed/log/file', () => {
  let loglist = Mock.mock({
    'list|100': [
      {
        id: function () {
          return `log_${Mock.Random.increment()}`
        },
        userId: '@string',
        userName: '@name',
        action: '@string',
        operationModule: '@string',
        operationMsg: '@string',
        createTime: '@date(yyyy-MM-dd HH:mm:ss)',
        remoteAddr: '@string',
        requestIp: '@string',
        'accessSuccess|0-1': 1,
        'accessDuration|1-100': 23,
      },
    ],
  })
  return HttpResponse.json({
    success: true,
    errorCode: '',
    errorMessage: '',
    data: {
      records: loglist.list,
      total: 100,
    },
  })
})
// 查单个
export const operationList = http.get('/data/ed/log/operation/module', () => {
  return HttpResponse.json({
    success: true,
    errorCode: '',
    errorMessage: '',
    data: [
      {
        text: '操作记录审计',
        value: 'log',
      },
      {
        text: '临时文件',
        value: 'tmp',
      },
      {
        text: '标签管理',
        value: 'tag',
      },
    ],
  })
})
